package com.rockcent.message;

import com.rockcent.common.common.RWebMvcConfigurerAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

/**
 * Created by zhangjh on 2017/1/13.
 */
@Configuration
@EnableWebMvc
public class WebMvcConfig extends RWebMvcConfigurerAdapter {

    @Autowired
    private AuthInterceptor authInterceptor;

    @Autowired
    private AuthUserInterceptor authUserInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        super.addInterceptors(registry);
        registry.addInterceptor(authInterceptor)
                .excludePathPatterns("/monitor/telnet/info")
                .excludePathPatterns("/api/local/**").excludePathPatterns("/api/local/pushmsg-to-server");

        registry.addInterceptor(authUserInterceptor)
                .excludePathPatterns("/monitor/telnet/info")
                .excludePathPatterns("/api/local/**").excludePathPatterns("/api/local/pushmsg-to-server");
    }

}
